Gasoline molecular blending technology on?line requires rapid access to detailed molecular composition information of various types of component oils. In this paper, an autoencoder?based method for the rapid resolution of gasoline molecular composition is developed, which can directly predict the detailed monomeric hydrocarbon composition of gasoline from near?infrared spectra. The constructed autoencoder model of gasoline molecular composition can explore the potential features and recover the original molecular composition by decoding the potential features. The artificial neural network algorithm is used to correlate the NIR spectral information with the potential features of gasoline composition. The accuracy of the model is verified by using hydrogenated gasoline with the average absolute error is 0.033. The model developed in this work applies the current popular autoencoder algorithm to the traditional petrochemical process, which is an important guideline for blending online and real?time optimization of gasoline molecules.